/**
 * @Author JeryZym
 * @Date 20170606
 */
require.config({
    urlArgs: "r=" + (new Date()).getTime(),
    baseUrl: './',
    paths: {
        // requieJs related
        'domReady': 'assets/require/domReady',
        'text': 'assets/require/text',
        'css': 'assets/require/css.min',
        // jquery related
        'jquery': 'assets/jquery/1.11.1/jquery.min',
        'cookie': 'assets/jquery/jquery.cookie',
        'json2': 'assets/jquery/json2',
        'bootbox': 'assets/jquery/bootbox.min',
        'accordion': 'assets/according/jquery-accordion-menu',
        'fakeLoader': 'assets/jquery/fakeLoader.min',
        'jsTree': 'assets/jquery/jstree/jstree.min',
        'bootstrapValidator': 'assets/bootstrap-validator/js/bootstrapValidator',
        'bootstrapValidator-zhCN': 'assets/bootstrap-validator/js/language/zh_CN',
        'fileinput': 'assets/bootstrap-fileinput-master/js/fileinput.min',
        'fileinput-zh': 'assets/bootstrap-fileinput-master/js/locales/zh',
        // bootstrap related
        'bootstrap': 'assets/bootstrap/3.3.7/js/bootstrap.min',
        'bootstrap-table': 'assets/bootstrap-table/bootstrap-table.min',
        'bootstrap-table-zh-CN': 'assets/bootstrap-table/locale/bootstrap-table-zh-CN.min',
        // 'bootstrap-treeview': 'assets/boostrap-treeview/bootstrap-treeview.min',
        'bootstrap-select': 'assets/bootstrap-select/js/bootstrap-select.min',
        'bootstrap-datetimepicker': 'assets/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min',
        'bootstrap-datetimepicker-zh-CN': 'assets/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN',
        'sco.msg': 'assets/sco/js/sco.message',
        // knockout related
        'knockout': 'assets/knockout/knockout',
        'knockout-amd-helpers': 'assets/knockout/knockout-amd-helpers.min',
        'knockout.mapping': 'assets/knockout/knockout.mapping-latest',
        // 'knockout.validate': 'assets/knockout/knockout.validation.min',
        // 'knockout.validate.zh': 'assets/knockout/knockout.validation.locales.zh-CN',
        'knockout-bsTable': 'assets/js/core/knockout-bootstrapTable',
        'knockout-bsTree': 'assets/js/core/knockout-bootstrapTree',
        'knockout-bsDatetimepicker': 'assets/js/core/knockout-datetimepicker',
        'knockout-jsTree': 'assets/js/core/knockout-jsTree',
        'knockout-fileinput': 'assets/js/core/knockout-fileinput',
        'knockout-component': 'assets/js/core/knockout-component',
        ///anychart
        'anychart-base': 'assets/anychart/js/anychart-base.min',
        'anychart-core': 'assets/anychart/js/anychart-core.min',
        'anychart-exports': 'assets/anychart/js/anychart-exports.min',
        'anychart-ui': 'assets/anychart/js/anychart-ui.min',
        'anychart-stock': 'assets/anychart/js/anychart-stock.min',
        'anychart-pareto': 'assets/anychart/js/anychart-pareto.min',
        'anychart-zh-CN': 'assets/anychart/locales/zh-cn',
        'anychart-theme-coffee': 'assets/anychart/themes/coffee.min',
        'anychart-theme-lightblue': 'assets/anychart/themes/light_blue.min',
        //echarts
        'echarts': 'assets/echarts/echarts.min',
        'echarts-theme-shine': 'assets/echarts/theme/shine',
        //
        'director': 'assets/director/director.min',
        // user-defined script
        'ajaxSetup': 'assets/js/core/ajaxSetup.r',
        'platform.common': 'assets/js/core/platform.common',
        'ikgMenu': 'assets/js/core/bootstrap-menu',
        'websocket': 'assets/js/core/websocket',
        'sockjs': 'assets/js/sockjs.min',
        'app': 'module/framework/index/index'
    },
    shim: {
        'json2': ['jquery'],
        'fakeLoader': ['jquery'],
        'jsTree': ['jquery'],
        'bootstrap': ['jquery'],
        'bootstrap-table-zh-CN': ['bootstrap-table'],
        'bootstrapValidator-zhCN': ['bootstrapValidator'],
        'bootstrap-datetimepicker-zh-CN': ['bootstrap-datetimepicker'],
        'fileinput': ['jquery'],
        'fileinput-zh': ['fileinput'],
        'anychart-exports': ['anychart-base'],
        'anychart-ui': ['anychart-base'],
        'anychart-stock': ['anychart-core', 'anychart-zh-CN', 'anychart-ui', 'css!assets/anychart/css/anychart-ui.min.css'],
        'anychart-pareto': ['anychart-core', 'anychart-zh-CN', 'anychart-ui', 'anychart-exports'],
        'echarts-theme-shine': ['echarts'],
        'platform.common': ['jquery', 'json2', 'cookie', 'sco.msg'],
        'websocket': ['json2'],
        'knockout-amd-helpers': ['knockout'],
        // 'knockout.validate': ['knockout'],
        // 'knockout.validate.zh': ['knockout.validate'],
        'app': ['knockout', 'jquery']
    }
});
require(['knockout',
    'domReady!',
    'app',
    'knockout-amd-helpers',
    'css!assets/bootstrap/3.3.7/css/bootstrap.min.css',
    'css!assets/bootstrap/3.3.7/css/bootstrap-theme.min.css',
    'css!assets/css/default.css'], function (ko) {

    ko.amdTemplateEngine.defaultPath = "./";
    ko.amdTemplateEngine.defaultSuffix = ".tmpl.html";
    ko.amdTemplateEngine.defaultRequireTextPluginName = "text";

    ko.bindingHandlers.module.baseDir = "./";
    ko.bindingHandlers.module.templateProperty = "embeddedTemplate";

    var app = require('app');
    app.init();
    ko.applyBindings(app);
});